<?php
/**
 * start
 */
require_once 'library/inc.php';

/**
 * init request.
 */
$request = Agis::getRequest();

/**
 * init response
 */
$response = Agis::getResponse();

/**
 * init router
 */
$router = Agis::getHelper('@router');

/**
 * match router
 */
if (!$router -> match($request))
{
    $request -> setHandler('core@error:error404');
}

/**
 * dispatch main request.
 */
$request -> execute($response);

/**
 * define some layout rendered.
 */
echo Agis::getHelper('@render') -> renderPage('default', $request -> getHandlerId(), Agis::get('siteId'));

/**
 * end process
 */
Agis::fireEvent('onRequestShutdown');
